home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 March / EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso / earcd / patches / pgs3g1.lha / 3.0gUpdate / Macros.LHA / SendtoPageLiner.rexx < prev    next >
OS/2 REXX Batch file  |  1995-03-24  |  3KB  |  109 lines

  1. /* $VER: SendtoPageLiner.rexx 1.2 (24.03.95)
  2.    Copyright 1995 Soft-Logik Publishing Corporation
  3.    May not be distributed without Soft-Logik Publishing Corporation's express written permission */
  4.  
  5. OPTIONS RESULTS
  6. TRACE OFF
  7.  
  8. /* Make sure rexx support is opened */
  9. IF ~SHOW('L','rexxsupport.library') THEN
  10.    CALL ADDLIB('rexxsupport.library',0,-30)
  11.  
  12. ADDRESS 'PAGESTREAM'
  13.  
  14. /* If text is not selected, select the current article */
  15. getcursor characterstart sID characterend eID
  16. if sID=eID then 'selecttext all'
  17.  
  18. /* Export the article to a temp file */
  19. 'lockinterface true'
  20. 'exporttext file t:HotLinkedArticle filter ascii textcode PageStream status force'
  21. /* Eventually will just make article external, but not this version */
  22. /* 'editarticle external file t:HotLinkedArticle' */
  23. 'refresh wait'
  24.  
  25. /* set the default PageLiner path */
  26. plpath='PageStream3:PageLiner'
  27. preffile='PageStream3:SendtoPageLiner.prefs'
  28.  
  29. /* If PageLiner doesn't exist in the default path, check SendtoPageLiner.prefs */
  30. if ~exists(plpath) then do
  31.     if open(.ifile, preffile, 'R') then do
  32.         plpath=readln(.ifile)
  33.         call close(.ifile)
  34.         askuser='no'
  35.         end
  36.     else do
  37.         askuser='yes'
  38.     end
  39.     /* If PageLiner doesn't exist in the set pref path, ask the user where it is */
  40.     if ~exists(plpath) | askuser='yes' then do
  41.         getfile TITLE "'Please locate PageLiner'" load path "'PageStream3:'" file 'PageLiner' posbutton 'Ok' negbutton 'Cancel'
  42.         if RC=10 then signal cancel
  43.         plpath=result
  44.         if open(.ifile, preffile, 'W') then do
  45.             call writeln(.ifile, plpath)
  46.             call close(.ifile)
  47.         end
  48.     end
  49. end
  50.  
  51.  
  52. /* Run PageLiner */
  53. ADDRESS COMMAND
  54. 'run >nil:' PLpath
  55.  
  56. /* Wait until the ARexx port shows up */
  57. do 20
  58.     if ~show(P, 'PAGELINER') then call delay(50)
  59. end
  60.  
  61. /* If the ARexx port didn't show up, alert the user and exit */
  62. if ~show(P, 'PAGELINER') then do
  63.     ADDRESS 'PAGESTREAM'
  64.     allocarexxrequester '"Send to Editor Error!"' 368 59
  65.     reqhandle=result
  66.     addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
  67.         Exithandle=result
  68.     addarexxgadget reqhandle TEXT 8 10 352 border none string "'PageLiner could not be started.'"
  69.     doarexxrequester reqhandle
  70.     freearexxrequester reqhandle
  71.     'refresh continue'
  72.     'lockinterface false'
  73.     EXIT
  74. end
  75.  
  76. ADDRESS 'PAGELINER'
  77. 'open t:HotLinkedArticle'
  78. 'cursor down'
  79.  
  80. /* Wait for the user to finish in PageLiner */
  81. do forever
  82.     'getarticle t:hotlinkedarticle'
  83.     if rc=0 then call delay(50)
  84.     else signal update
  85. end
  86.  
  87. /* Update PageStream and exit */
  88. UPDATE:
  89. ADDRESS 'PAGESTREAM'
  90. 'screentofront'
  91. /* Eventually will just make article external, but not this version */
  92. /* 'editarticle path t:HotLinkedArticle' */
  93. /* 'editarticle internal' */
  94.  
  95. 'inserttext file t:HotLinkedArticle filter ascii textcode PageStream'
  96.  
  97. /* deselect the text if rquired */
  98. if sID=eID then selecttext none
  99.  
  100. signal cancel
  101.  
  102. CANCEL:
  103. ADDRESS 'PAGESTREAM'
  104. 'refresh continue'
  105. 'lockinterface false'
  106. ADDRESS COMMAND
  107. 'delete t:HotLinkedArticle'
  108. EXIT
  109.